<div class="admin_title_header clearfix">
  <h3>Deals</h3>
  <%= link_to "New Deal", new_admin_generic_deal_path, :class => "button" %>
</div>

<div class="admin_deals">
  <table class='hover'>
    <thead>
    <tr class='odd'>
      <th  class='column1_header'><%= sortable 'buy_quantity', 'Buy Quantity' %></th>
      <th>Get Percentage</th>
      <th>Deal Type</th>
      <th>Product Type</th>
      <th>Get Amount</th>
      <th>Deleted At</th>
      <th></th>
      <th></th>
    </tr>
    </thead>
    <tbody>
    <% for deal in @deals %>
      <tr  class='<%= cycle("odd", "")%>'>

          <td><%= link_to deal.buy_quantity, [:admin, :generic, deal] %></td>
          <td><%= deal.get_percentage %></td>
          <td><%= deal.deal_type.name %></td>
          <td><%= deal.product_type.name %></td>
          <td><%= deal.get_amount %></td>
          <td><%= deal.deleted_at %></td>
        <td>
        <%#  YOU SHOULD NOT EDIT THIS..  OLD ORDERS WILL NO LONGER CALCULATE CORRECTLY.  set Deleted_at and create a new promotion %>
        <%#= link_to "edit", edit_admin_generic_deal_path(deal) %></td>
        <td><%= link_to "delete", [:admin, :generic, deal], :data => {:confirm => 'Are you sure?'}, :method => :delete %></td>
      </tr>
    <% end %>
    </tbody>
  </table>
</div>

<%= will_paginate @deals %>
